let fs = require('fs');
let start=new Date().getTime();
let end=0;
let obj={
    createfile:function(filename,string){
        fs.writeFile(filename,string,function(err){
            end++;
            if(end==999){
                let endtime=new Date().getTime();
                console.log("耗时"+(endtime-start));
            }
        });
    },
    createRandom:function(num){
        return (Math.ceil(Math.random()*num)+1)
    },
    init:function(){
        for(let i= 1;i<=1000;i++){
            let filename= "./files/"+i+".txt";
            let num=this.createRandom(1000)
            this.createfile(filename,num+"");
        };
    }
}
obj.init();